package com.shuyu.common.utils.aliyun;


import java.util.HashMap;
import java.util.Map;

public class SendSmsUtil {
    private static String accessKeyId = "LTAI5t61RXfUN88NDnA7C2xi";
    private static String accessKeySecret = "Nu4gf2Q41uYP6ZIUJLJvTTRw3Tnuor";
    private static String endpoint = "dysmsapi.aliyuncs.com";
    private static String action = "SendSms";
    private static String version = "2017-05-25";

    public static AliyunResponseBody send(String mobile, String code) throws Exception {
        Map<String, Object> queries = new HashMap<>();
        queries.put("PhoneNumbers", mobile);
        queries.put("SignName", "数与文化科技");
        queries.put("TemplateCode", "SMS_286196034");
        queries.put("TemplateParam", "{\"code\":\""+code+"\"}");
        AliyunParam aliyunParam = new AliyunParam(accessKeyId, accessKeySecret, endpoint, action, version, queries);

        return AliyunCommon.excute(aliyunParam);
    }
    public static AliyunResponseBody sendTransfer(String mobile, String code,String nickName, String cardNo) throws Exception {
        Map<String, Object> queries = new HashMap<>();
        queries.put("PhoneNumbers", mobile);
        queries.put("SignName", "数与文化科技");
        queries.put("TemplateCode", "SMS_475980057");
        queries.put("TemplateParam", "{\"code\":\""+code+"\",\"card_no\":\""+cardNo+"\",\"name\":\""+nickName+"\"}");
        AliyunParam aliyunParam = new AliyunParam(accessKeyId, accessKeySecret, endpoint, action, version, queries);
        return AliyunCommon.excute(aliyunParam);
    }

}
